<html>
<head><meta charset="utf-8"><title>remaining-ignore-compare-mode-tests · t-compiler/wg-nll · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/index.html">t-compiler/wg-nll</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html">remaining-ignore-compare-mode-tests</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="136290371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290371">(Oct 22 2018 at 19:50)</a>:</h4>
<p>So, there are 2 tests which have <code>ignore-compare-mode-nll</code> which don't use revisions or have a comment. <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/cleanup-rvalue-scopes-cf.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/cleanup-rvalue-scopes-cf.rs">https://github.com/rust-lang/rust/blob/master/src/test/ui/cleanup-rvalue-scopes-cf.rs</a> and <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-28848.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-28848.rs">https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-28848.rs</a></p>



<a name="136290483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290483">(Oct 22 2018 at 19:52)</a>:</h4>
<p>The second one has the same behaviour for both AST and migrate borrow check, and if the explicit lifetimes are removed it compiles, so doesn't seem like a huge priority.</p>



<a name="136290522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290522">(Oct 22 2018 at 19:53)</a>:</h4>
<p>Those are likely tests that failed on NLL compare mode when I was doing the compile-fail migration. They were listed in <a href="https://github.com/rust-lang/rust/issues/53351" target="_blank" title="https://github.com/rust-lang/rust/issues/53351">#53351</a>.</p>



<a name="136290589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290589">(Oct 22 2018 at 19:54)</a>:</h4>
<p>They still do (if compare mode used still used <code>-Zborrowck=mir</code>)</p>



<a name="136290744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290744">(Oct 22 2018 at 19:56)</a>:</h4>
<p>The first one is more immediately unusable variables, but it's not as clear here that it should fail to compile. Since the temporaries are dropped after the assignment (this is observable using a pattern that partially moves the value)</p>



<a name="136290779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290779">(Oct 22 2018 at 19:57)</a>:</h4>
<p>And there's still the argument that it has to suppress lints to compile without warning</p>



<a name="136290943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290943">(Oct 22 2018 at 19:59)</a>:</h4>
<p>hmm</p>



<a name="136290960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136290960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136290960">(Oct 22 2018 at 20:00)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="cp">#![feature(nll)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;b</span>: <span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="p">());</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">xmute</span><span class="p">(</span><span class="n">a</span>: <span class="kp">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="p">())</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">unreachable</span><span class="o">!</span><span class="p">()</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="p">(</span><span class="n">u</span>: <span class="kp">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="p">())</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Foo</span>::<span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;b</span><span class="o">&gt;</span>::<span class="n">xmute</span><span class="p">(</span><span class="n">u</span><span class="p">)</span><span class="w"> </span><span class="c1">//~ ERROR lifetime bound not satisfied</span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</pre></div>


<p>that is the "other one" you are referring to?</p>



<a name="136291091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291091">(Oct 22 2018 at 20:01)</a>:</h4>
<p>i.e., <code>issue-28848.rs</code>?</p>



<a name="136291102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291102">(Oct 22 2018 at 20:01)</a>:</h4>
<p>that looks like a user type annot bug, and one that I'm a <em>bit</em> surprised to see is not fixed</p>



<a name="136291262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291262">(Oct 22 2018 at 20:03)</a>:</h4>
<p>I don't think we check <code>Self</code> is a well formed type when checking <code>typeof(Self::method)</code> is. (AST borrowck accepts this code if the lifetimes are removed)</p>



<a name="136291372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291372">(Oct 22 2018 at 20:05)</a>:</h4>
<p>hmm</p>



<a name="136291380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291380">(Oct 22 2018 at 20:05)</a>:</h4>
<p>seems like an easy fix</p>



<a name="136291385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291385">(Oct 22 2018 at 20:05)</a>:</h4>
<p>I agree that is likely the problem</p>



<a name="136291407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291407">(Oct 22 2018 at 20:05)</a>:</h4>
<p>I could maybe throw into my yet-to-be-merged PR</p>



<a name="136291786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291786">(Oct 22 2018 at 20:11)</a>:</h4>
<p>Well, you have until bors recovers, so you should have time.</p>



<a name="136291984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291984">(Oct 22 2018 at 20:14)</a>:</h4>
<p>We should remove the <code>// ignore-compare-mode-nll</code> from the tests that work under migrate mode</p>



<a name="136291990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291990">(Oct 22 2018 at 20:14)</a>:</h4>
<p>(in my opinion)</p>



<a name="136291999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136291999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136291999">(Oct 22 2018 at 20:14)</a>:</h4>
<p>keep our effort focused in short term of the things that would plague the edition</p>



<a name="136292312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292312">(Oct 22 2018 at 20:19)</a>:</h4>
<p>re: <a href="http://cleanup-rvalue-scopes-cf.rs" target="_blank" title="http://cleanup-rvalue-scopes-cf.rs">cleanup-rvalue-scopes-cf.rs</a>, you <em>will</em> get errors if you add <code>drop(_x)</code> after each <code>let</code> ...</p>



<a name="136292333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292333">(Oct 22 2018 at 20:19)</a>:</h4>
<p>yes</p>



<a name="136292334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292334">(Oct 22 2018 at 20:19)</a>:</h4>
<p>Hmm. Didn't we add something that would read a variable right after it was written? I wonder where those reads fell, relative to the scope of such temporaries as these</p>



<a name="136292417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292417">(Oct 22 2018 at 20:20)</a>:</h4>
<p>The order is assign, fake read, temporaries droped</p>



<a name="136292442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292442">(Oct 22 2018 at 20:21)</a>:</h4>
<p>should we ... consider ... inverting the last two steps there ... ?</p>



<a name="136292458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292458">(Oct 22 2018 at 20:21)</a>:</h4>
<p>or should we just change the test here by adding <code>drop(_x);</code> after each <code>let</code> ?</p>



<a name="136292521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292521">(Oct 22 2018 at 20:22)</a>:</h4>
<p>I tried that, it changes drop order in some cases and requires some hacks to ensure that the outermost temporary is dropped after the assignment.</p>



<a name="136292532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292532">(Oct 22 2018 at 20:22)</a>:</h4>
<blockquote>
<p>or should we just change the test here by adding <code>drop(_x);</code> after each <code>let</code> ?</p>
</blockquote>
<p>Probably this</p>



<a name="136292538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292538">(Oct 22 2018 at 20:22)</a>:</h4>
<p>Okay. I think that to preserve the <em>spirit</em> of the test in the face of NLL, we are fine just ading <code>drop(_x);</code> after each <code>let</code></p>



<a name="136292549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136292549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136292549">(Oct 22 2018 at 20:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> : are you cool with ^ ?</p>



<a name="136334477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136334477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136334477">(Oct 23 2018 at 12:45)</a>:</h4>
<blockquote>
<p>I tried that, it changes drop order in some cases and requires some hacks to ensure that the outermost temporary is dropped after the assignment.</p>
</blockquote>
<p>how can it change drop order?</p>



<a name="136334534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136334534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136334534">(Oct 23 2018 at 12:46)</a>:</h4>
<p>I'm fine with adding <code>drop</code> to preserve the spirit of the test, though I'd prefer to rename from <code>_x</code> to <code>x</code> =)</p>



<a name="136334538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136334538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136334538">(Oct 23 2018 at 12:46)</a>:</h4>
<p>but I don't fully understand yet why we can't change the order :)</p>



<a name="136334545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136334545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136334545">(Oct 23 2018 at 12:46)</a>:</h4>
<blockquote>
<p>Well, you have until bors recovers, so you should have time.</p>
</blockquote>
<p>trying now</p>



<a name="136360986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136360986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136360986">(Oct 23 2018 at 19:31)</a>:</h4>
<p>OK, so currently this compiles and prints <code>drop(0) drop(1) drop(-1)</code>: first we drop (what remains of) the RHS temporary, then the temporary for <code>D(1)</code>, then <code>v</code>.</p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">D</span><span class="p">(</span><span class="kt">i32</span><span class="p">);</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="nb">Drop</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">D</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">drop</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">print</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;drop({}) &quot;</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="n">v</span><span class="p">,</span><span class="w"> </span><span class="p">..)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="n">D</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span><span class="w"> </span><span class="n">D</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span><span class="w"> </span><span class="n">D</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="136361071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136361071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136361071">(Oct 23 2018 at 19:32)</a>:</h4>
<p>If we want to drop <code>D(1)</code> before the assignment to <code>v</code>, then it has to be dropped before the RHS temporary, since the RHS temporary is needed for the assignment.</p>



<a name="136361118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests/near/136361118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/122657-t-compiler/wg-nll/topic/remaining-ignore-compare-mode-tests.html#136361118">(Oct 23 2018 at 19:33)</a>:</h4>
<p>We could add a fake read after all of the temporaries are dropped, but now this read isn't really representing anything in the source code.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>